<template>
    <div class="exprssSelectBox">
        <!--<group >
            <radio :options="radio003" v-model="radio001Value" @click.native="showPlugin" @on-change="change"></radio>    
        </group>
        <group :title="'fill mode value is '+radio001Value">
        <radio :selected-label-style="{color: '#FF9900'}" fill-mode :options="radio001" v-model="radio001Value" @on-change="change"></radio>
        </group>-->
        <group v-for="(item,$index) in expressData">
            <cell  is-link @click.native="showPlugin($index)" value-align="left">
                <span>{{item.expressName}}</span>
                <img slot="icon" width="20" style="display:block;margin-right:5px;" :src="item.expressImg">
            </cell>
        </group>
 
    </div>  
</template>
<script>
    import { Radio, Group,XButton ,Confirm,Toast,Cell} from 'vux'
    import store from '@/vuex/store'

    export default {
        data(){
            return{
                expressData:[],
            }
        },
        methods:{
            change (value) {
                console.log('change:', value)
                },
            showPlugin ($index) {
                var _this = this;
                this.$vux.confirm.show({
                    // title: 'Title',
                    content: '确认选择',
                    onShow () {
                        console.log('plugin show')
                        },
                        onHide () {
                        console.log('plugin hide')
                        },
                        onCancel () {
                        console.log('plugin cancel')
                        },
                        onConfirm () {
                            _this.$store.state.express = _this.expressData[$index]
                            _this.$store.commit('showUserName')
                            _this.$router.go('-1')
                        }
                    })
            }
           
        },
        created(){
            console.log(this.$store.state.siteId)
            var id = this.$store.state.siteId;
            var _this = this;
           $.ajax({
               url:'http://bg.test.baimixu.cn/index.php?m=Home&c=SendApi&a=getExpresss',
               data:{stationId:id},
               type:'get',
               dataType:'jsonp',
               success:function(data){
                    if(!data.success){
                        _this.$vux.toast.show({
                            text:'该站点没有添加快递公司'
                        })
                    }
                    console.log(data.d)
                    _this.expressData = data.d;
               }
           })
        },
        components:{
            Radio,
            Group,
            Confirm,
            Toast,
            Cell
        },
        store
    }
</script>
